package com.example.hp.week12;

import android.content.Intent;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;

public class ParentActivity extends AppCompatActivity {

    Button seekChildBnt;
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_parent);

        setTitle("上一级页面");
        //初始化按钮组件
        seekChildBnt = (Button) findViewById(R.id.seekChildBnt);
        //设置单击事件
        seekChildBnt.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                //单击后转向下一级页面
                Intent intent = new Intent(ParentActivity.this, ChildActivity.class); //创建 Intent 对象
                startActivity(intent); //启动 Activity
            }
        });
    }
}
